<template>
	<view>
		<view class="cu-list menu sm-border card-menu margin-top" v-if="list.length>0">
			<navigator class="cu-item arrow" v-for="(item,index) in list" :url="'/pages/my/feedbackInfo?id='+item.id">
				<view class="content">
					<text class="text-grey">{{item.title}}</text>
				</view>
				<view class="action">
					<text class="text-grey text-sm">{{item.createtime|timeStamp}}</text>
				</view>
			</navigator>
		</view>
		<view class="padding" v-else>
			<u-empty
					mode="list"
					icon="http://cdn.uviewui.com/uview/empty/list.png">
			</u-empty>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[]
			}
		},
		onLoad() {
			this.initDate();
		},
		filters: {
			timeStamp: function(value) {
				if (!value) return '';
				var now = new Date(value*1000);
				var year = now.getFullYear();
				var month = now.getMonth() + 1;
				if (month < 10) {
					month = '0' + month
				}
				var date = now.getDate();
				if (date < 10) {
					date = '0' + date
				}
				// var h = (now.getHours() < 10 ? '0' + now.getHours() : now.getHours()) + ':';  
				// var m = (now.getMinutes() <10 ? '0' + now.getMinutes() : now.getMinutes()) + ':';  
				// var s = (now.getSeconds() <10 ? '0' + now.getSeconds() : now.getSeconds());  
				//return month + "/" + date +" "+h+m+s
				return year + "/" + month + "/" + date
			}
		},
		methods: {
			async initDate() {
				const res = await this.$API({url: '/api/index/retroaction', method: 'POST'});
				if (res.code === 1) {
					this.list = res.data
				} else {
					uni.showToast({
						icon: 'none',
						title: res.msg
					})
				}
				
			},
		}
	}
</script>

<style>

</style>
